package com.sxbbc.common.core.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sxbbc.common.core.entity.jz.SysNews;
import com.sxbbc.common.core.mapper.jz.SysNewsMapper;
import com.sxbbc.common.core.service.ISysNewsService;
import com.sxbbc.common.core.utils.BasePage;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * <p>
 * 新闻信息 服务实现类
 * </p>
 *
 * @author leehao
 * @since 2019-04-29
 */
@Service
public class SysNewsServiceImpl extends ServiceImpl<SysNewsMapper, SysNews> implements ISysNewsService {

	@Override
	public Page<SysNews> querySysNewsList(BasePage<SysNews> page) {
		  QueryWrapper<SysNews> wrapper = new QueryWrapper<SysNews>();
	      wrapper.orderByDesc("createtime");
	     if (page.isPaging()) {
	            super.page(page, wrapper);
	     } else {
	            List<SysNews> list = super.list(wrapper);
	            page.setRecords(list);
	     }
	     return page;
	}

	
	public SysNews getSysNewsById(Integer id) {
		return super.getById(id);
	}

}
